<template>
  <div>
    <el-form :model="form">
      <el-form-item label="名称" prop="sensorName">
        <el-input v-model="form.sensorName" disabled/>
      </el-form-item>

      <el-form-item label="转换公式" prop="expression">
<!--        <span slot="label">转换公式-->
<!--          <el-tooltip placement="top-start" effect="dark">-->
<!--              <div slot="content">我是el-tooltip提示内容</div>-->
<!--              <i class="el-icon-question"></i>-->
<!--          </el-tooltip>-->
<!--        </span>-->
        <el-input v-model="form.expression" placeholder="例：(ANS-400)/(2000-400)*(100-0)">
          <el-button slot="append" @click="changeExpression">设置</el-button>
        </el-input>
      </el-form-item>

    </el-form>

  </div>
</template>

<script>

import { changeInfo } from '@/api/equipment/sensor'

export default {
  name: 'index',
  props: {
    sensor: {
      type: Object
    }
  },
  data() {
    return {
      form: {}
    }
  },
  created() {
    this.form = this.sensor
  },
  methods: {
    changeExpression() {
      let obj = {
        sensorId: this.form.sensorId,
        expression: this.form.expression
      }
      changeInfo(obj).then(response => {
        this.$message.success('设置成功')
      })
    }
  }
}
</script>

<style scoped>

</style>
